/*
 * StemIsland.h
 *
 *  Created on: 25/ott/2013
 *      Author: angelo
 */

#ifndef STEMISLAND_H_
#define STEMISLAND_H_

#include <stdlib.h>
#include <stdio.h>
#include <list>
#include <vector>

#include "Coordinates.h"
#include "Survivor.h"
#include "Circle.h"
#include "Node.h"

class StemIsland : public Node {
public:
	StemIsland(int numberOfRadios, double coverageRadius);
	virtual ~StemIsland();
	int getID(void);

	void addCoveredSurvivor(Survivor * surv);

	bool isInChannelList(int channelToCheck);
	bool addNewChannel(int channelToAdd);

	bool canBeCovered(Coordinates newPoint);

	Coordinates getPositionFromSurvivors (void);

	virtual int getNodeCardinality(void);

private:

	Circle *findSec(int n, vector<Coordinates> p, int m, vector<Coordinates> b);
	Circle *calculateCenterFromCoord(list<Coordinates> lc);

public:
	int nRadio;
	double radius;
	//Coordinates pos;  //ereditato from node
	list<int> channel;

	list<Survivor *> coveredSurvivors;

	int stemIsland_id;

private:
	static int counter_stemIsland_id;
};

#endif /* STEMISLAND_H_ */
